<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .active {
        color: red;
      }
    </style>
  </head>

  <body>
    <div id="app"></div>

    <template id="my-app">
      <!-- 
			数组语法：[类名1, 类名2]
				- 类名加引号则当成字符串，不加则当成data中的属性
				- 可以使用三元表达式
				- 可以嵌套对象语法
		 -->
      <div :class="['abc', title]">{{message}}</div>
      <div :class="['abc', title, isActive ? 'active' : '']">{{message}}</div>
      <div :class="['abc', title, {active: isActive}]">{{message}}</div>
    </template>

    <script src="../js/Vue.js"></script>
    <script>
      const app = {
        template: '#my-app',
        data() {
          return {
            message: 'Hello World',
            title: 'abc',
            isActive: true
          }
        }
      }

      Vue.createApp(app).mount('#app')
    </script>
  </body>
</html>
